home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / comt010d.zip / COMTSRC.ZIP / LDR.ASM < prev    next >
Assembly Source File  |  1991-11-09  |  1KB  |  54 lines

  1. .model tiny
  2. .code
  3. org 100h
  4.  
  5. include enc.inc
  6.  
  7. Origin=EncLoadedAt-100h
  8. ;jmp 1c4h
  9. ;org 1c4h
  10. Top:
  11.   cld
  12.   push di         ; di points after the decoding
  13.                   ; this space is free since it was filled before
  14.                   ; with the encoded original
  15.   mov si,offset BegMoveData+Origin
  16.   mov cx,offset EndMoveData-offset BegMoveData
  17.  
  18.   rep movsb
  19.   pop di
  20.   jmp di
  21.  
  22. ; This stuff now had better be relocatable.  On entry di points to its
  23. ; head.
  24. BegMoveData:
  25. ; Copy the (now) decoded programme to ds:100=cs:100=es:100
  26.   mov cx,di
  27.   sub cx,offset RealCode+Origin   ; length of decoded program
  28.   inc cx
  29.   shr cx,1    ; cx>=2*Length of decoded program
  30.   mov si,offset RealCode+Origin
  31.   mov di,100h
  32.   rep movsw
  33.  
  34.   mov ax,100h
  35.   push ax
  36.   xor ax,ax  ; I am sure some are not needed, so I commented them out
  37. ;  mov bx,ax
  38.   mov cx,ax
  39. ;  mov dx,ax
  40.   mov si,ax
  41.   mov di,ax
  42.   mov bp,ax
  43.   ret         ; jump to 100h
  44. EndMoveData:
  45.  
  46. ;db 0,0,0,0,0,0,0,0  ; room for 16 character version number if wanted
  47.  
  48. RealCode = $+((8+8+4)/2)
  49. ;org Top+(01e0h-01c4h)
  50. ;  mov ax,4c00h
  51. ;  int 21h
  52.  
  53. end Top
  54.